package com.wzt.gift.fallback;

import com.wzt.gift.clients.LoginUserClient;
import com.wzt.gift.domain.LoginUser;
import com.wzt.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author Zenith
 * @Date 2022/10/10 16:35
 * @Version 1.0
 */
@Component
public class LoginUserClientFallbackFactory implements FallbackFactory<LoginUserClient> {

    @Override
    public LoginUserClient create(Throwable throwable) {
        return new LoginUserClient() {
            @Override
            public AjaxResult addOrUpdate(@RequestBody LoginUser loginUser) {
                return new AjaxResult().me().setSuccess(false).setMessage("保存失败！");
            }

            @Override
            public AjaxResult list() {
                return null;
            }
        };
    }
}
